package com.sk.bilibili.config;

import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.sk.bilibili.factory.DefaultValueFactory;
import com.sk.bilibili.interceptor.BeforeUpdateInterceptor;
import com.sk.bilibili.interceptor.PostValueInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 邵康
 * @date 2021/11/24 8:44
 */
@Configuration
public class MyBatisConfig {

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    /**
     * 使用自定义工厂来应用简单的默认值  对象工厂必须配置
     */
    @Bean
    public ConfigurationCustomizer configurationCustomizer(DefaultValueFactory factory) {
        return configuration -> configuration.setObjectFactory(factory);
    }

}
